# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html

import time

class DemotianqiPipeline(object):
    def process_item(self, item, spider):
        now = time.strftime('%Y-%m-%d', time.localtime())
        fileName = 'book_' + now + '.txt'
        with open(fileName, 'a') as fp:
            fp.write(item['shijian'][0] + '\t')
            fp.write(item['tianqi'][0] + '\t')
            fp.write(item['qiWen'][0] + '\t')
            fp.write(item['fengXiang1'][0] + '\t')
            fp.write(item['fengXiang2'][0] + '\t')
            fp.write(item['fengXiangJiBie'][0] + '\n\n')
            time.sleep(1);
        return item
